@claudelaw/taichu 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.dockerignore +13 -0
  2. package/Dockerfile +51 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -0
  5. package/docker-compose.yml +42 -0
  6. package/docs/ROADMAP.md +101 -0
  7. package/docs/api/README.md +102 -0
  8. package/docs/architecture/001-zero-dependency-core.md +61 -0
  9. package/docs/architecture/002-structured-content-model.md +70 -0
  10. package/docs/architecture/003-hook-based-extension.md +82 -0
  11. package/docs/architecture/004-api-first-architecture.md +122 -0
  12. package/docs/architecture/README.md +24 -0
  13. package/docs/logo.svg +40 -0
  14. package/docs/research/ai-era-cms-user-research.md +247 -0
  15. package/docs/zh/README.md +81 -0
  16. package/docs/zh/guides/deploy.md +75 -0
  17. package/docs/zh/guides/mcp.md +84 -0
  18. package/docs/zh/guides/promotion.md +51 -0
  19. package/marketplace.json +78 -0
  20. package/package.json +60 -0
  21. package/packages/core/src/auth.js +158 -0
  22. package/packages/core/src/content-type.js +244 -0
  23. package/packages/core/src/core.test.js +406 -0
  24. package/packages/core/src/errors.js +60 -0
  25. package/packages/core/src/hooks.js +104 -0
  26. package/packages/core/src/index.js +16 -0
  27. package/packages/core/src/server.test.js +149 -0
  28. package/packages/core/src/sm-crypto.js +31 -0
  29. package/packages/core/src/sqlite-store.js +354 -0
  30. package/packages/core/src/store.js +174 -0
  31. package/packages/core/src/tokenizer.js +89 -0
  32. package/packages/core/src/vector-index.js +131 -0
  33. package/packages/llm-providers/src/index.js +181 -0
  34. package/packages/mcp/src/index.js +355 -0
  35. package/packages/server/public/admin/assets/index-DApxOVTx.js +191 -0
  36. package/packages/server/public/admin/assets/index-DtMvdQm9.css +1 -0
  37. package/packages/server/public/admin/index.html +28 -0
  38. package/packages/server/public/aurora/style.css +1173 -0
  39. package/packages/server/public/favicon.svg +46 -0
  40. package/packages/server/public/theme/index.html +288 -0
  41. package/packages/server/public/theme/style.css +133 -0
  42. package/packages/server/public/theme-minimal/index.html +223 -0
  43. package/packages/server/public/theme-minimal/style.css +109 -0
  44. package/packages/server/public/ws-test.html +106 -0
  45. package/packages/server/src/activitypub.js +228 -0
  46. package/packages/server/src/audit.js +104 -0
  47. package/packages/server/src/auth-provider.js +76 -0
  48. package/packages/server/src/body-parser.js +52 -0
  49. package/packages/server/src/bootstrap.js +272 -0
  50. package/packages/server/src/collab.js +154 -0
  51. package/packages/server/src/config.js +136 -0
  52. package/packages/server/src/context.js +86 -0
  53. package/packages/server/src/email.js +317 -0
  54. package/packages/server/src/index.js +195 -0
  55. package/packages/server/src/logger.js +78 -0
  56. package/packages/server/src/media-store.js +213 -0
  57. package/packages/server/src/middleware/auth.js +203 -0
  58. package/packages/server/src/middleware/cors.js +15 -0
  59. package/packages/server/src/middleware/error-handler.js +49 -0
  60. package/packages/server/src/middleware/rate-limit.js +118 -0
  61. package/packages/server/src/multipart.js +150 -0
  62. package/packages/server/src/notify.js +126 -0
  63. package/packages/server/src/pipeline.js +206 -0
  64. package/packages/server/src/plugin-installer.js +139 -0
  65. package/packages/server/src/plugin-manager.js +165 -0
  66. package/packages/server/src/relationships.js +217 -0
  67. package/packages/server/src/revisions.js +114 -0
  68. package/packages/server/src/router.js +194 -0
  69. package/packages/server/src/routes/activitypub.js +140 -0
  70. package/packages/server/src/routes/api.js +363 -0
  71. package/packages/server/src/routes/audit.js +222 -0
  72. package/packages/server/src/routes/auth.js +205 -0
  73. package/packages/server/src/routes/collab.js +90 -0
  74. package/packages/server/src/routes/export.js +77 -0
  75. package/packages/server/src/routes/graphql.js +344 -0
  76. package/packages/server/src/routes/media.js +169 -0
  77. package/packages/server/src/routes/plugin-marketplace.js +171 -0
  78. package/packages/server/src/routes/relationships.js +133 -0
  79. package/packages/server/src/routes/rss.js +92 -0
  80. package/packages/server/src/routes/sso.js +211 -0
  81. package/packages/server/src/routes/theme.js +119 -0
  82. package/packages/server/src/routes/webhook.js +94 -0
  83. package/packages/server/src/routes/wechat.js +115 -0
  84. package/packages/server/src/routes/workflow.js +157 -0
  85. package/packages/server/src/scheduler.js +96 -0
  86. package/packages/server/src/search.js +100 -0
  87. package/packages/server/src/server.test.js +295 -0
  88. package/packages/server/src/sso-analytics.js +78 -0
  89. package/packages/server/src/static.js +70 -0
  90. package/packages/server/src/theme-engine.js +119 -0
  91. package/packages/server/src/webhook.js +192 -0
  92. package/packages/server/src/websocket.js +308 -0
  93. package/scripts/cli.js +90 -0
package/.dockerignore ADDED
@@ -0,0 +1,13 @@
1
+ node_modules
2
+ .git
3
+ .taichu
4
+ *.md
5
+ !README.md
6
+ .vscode
7
+ .idea
8
+ *.log
9
+ coverage
10
+ .nyc_output
11
+ dist
12
+ .DS_Store
13
+ Thumbs.db
package/Dockerfile ADDED
@@ -0,0 +1,51 @@
1
+ # Taichu CMS — Docker 镜像
2
+ #
3
+ # 构建: docker build -t taichu .
4
+ # 运行: docker run -p 3120:3120 -v taichu-data:/app/.taichu taichu
5
+ #
6
+ # 默认使用 SQLite 存储,数据持久化到 .taichu/ 目录。
7
+
8
+ FROM node:22-alpine AS builder
9
+
10
+ WORKDIR /app
11
+
12
+ # Copy package files
13
+ COPY package*.json ./
14
+ COPY packages/core/package.json packages/core/
15
+ COPY packages/server/package.json packages/server/
16
+ COPY packages/mcp/package.json packages/mcp/
17
+ COPY packages/admin/package.json packages/admin/
18
+
19
+ # Install dependencies
20
+ RUN npm install --omit=dev 2>/dev/null || npm install
21
+
22
+ # Copy source
23
+ COPY . .
24
+
25
+ # Build admin SPA
26
+ RUN cd packages/admin && npx vite build 2>/dev/null || echo "Admin build skipped (pre-built)"
27
+
28
+ FROM node:22-alpine
29
+
30
+ WORKDIR /app
31
+
32
+ # Copy only what's needed for runtime
33
+ COPY --from=builder /app/node_modules ./node_modules
34
+ COPY --from=builder /app/package.json ./
35
+ COPY --from=builder /app/packages/core ./packages/core
36
+ COPY --from=builder /app/packages/server ./packages/server
37
+ COPY --from=builder /app/packages/mcp ./packages/mcp
38
+
39
+ ENV NODE_ENV=production
40
+ ENV TAICHU_STORAGE=sqlite
41
+ ENV TAICHU_PORT=3120
42
+ ENV TAICHU_HOST=0.0.0.0
43
+
44
+ EXPOSE 3120
45
+
46
+ VOLUME ["/app/.taichu"]
47
+
48
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
49
+ CMD node -e "require('http').get('http://localhost:3120/api/health',r=>{let d='';r.on('data',c=>d+=c);r.on('end',()=>process.exit(d.includes('ok')?0:1))})"
50
+
51
+ CMD ["node", "packages/server/src/index.js"]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Liu Huai'an (刘淮安) and Taichu contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ <p align="center">
2
+ <img src="docs/logo.svg" alt="Taichu" width="360" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="License: MIT" /></a>
7
+ <a href="#"><img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node.js >= 18" /></a>
8
+ <a href="CONTRIBUTING.md"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg" alt="Contributions Welcome" /></a>
9
+ <a href="#"><img src="https://img.shields.io/badge/stage-alpha-orange.svg" alt="Alpha Stage" /></a>
10
+ </p>
11
+
12
+ ---
13
+
14
+ ## What is Taichu?
15
+
16
+ Taichu is a **content management system built for the AI agent era**. While WordPress and Typecho were architected for human authors editing HTML in a browser, Taichu is architected for a world where AI agents are first-class content producers and consumers.
17
+
18
+ ### The Problem
19
+
20
+ - **WordPress / Typecho** store content as HTML strings in a database, designed for one human editing in a WYSIWYG editor and another human reading on a themed page
21
+ - **Headless CMS** (Strapi, Directus) separate content from presentation, but are still designed for human authors
22
+ - **AI agents** need structured, semantic content with discoverable APIs, fine-grained permissions, and content pipelines
23
+
24
+ ### Our Answer
25
+
26
+ Taichu treats **AI agents as first-class citizens** alongside human authors:
27
+
28
+ | | Traditional CMS | Headless CMS | **Taichu** |
29
+ |---|---|---|---|
30
+ | Authors | Humans only | Humans only | **Humans + AI Agents** |
31
+ | Content format | HTML strings | Structured JSON | **Semantic JSON-LD** |
32
+ | API | Afterthought (REST API plugin) | Primary (REST / GraphQL) | **Native (REST + GraphQL + MCP)** |
33
+ | Search | SQL LIKE | Full-text index | **Vector + Semantic** |
34
+ | Plugin model | Human-oriented (widgets, SEO) | Webhooks | **Agent Capability Extensions** |
35
+ | Permissions | Role-based (admin/editor/author) | Role-based | **Identity-based (Human + Agent + Scope)** |
36
+ | Deployment | LAMP stack | Docker / Cloud | **Single binary or Docker** |
37
+
38
+ ---
39
+
40
+ ## Philosophy
41
+
42
+ ### Content as Data, Not HTML
43
+
44
+ Taichu stores structured data — not HTML blobs. An article is a document with typed fields (`title: string`, `body: json`, `tags: array`), not a `wp_post` row with a `post_content` column full of HTML.
45
+
46
+ This means:
47
+ - AI agents can read and write content without parsing HTML
48
+ - Rendering is separated from storage — same content can be a web page, RSS feed, or agent response
49
+ - Relationships are native — fields can be typed as `relation` to other content types
50
+ - Search is semantic — embedding vectors live alongside structured fields
51
+
52
+ ### Agents Are First-Class Citizens
53
+
54
+ Every API endpoint, permission, and workflow is designed for both human and agent consumers:
55
+
56
+ ```bash
57
+ # Human access (JWT)
58
+ curl -H "Authorization: Bearer $JWT_TOKEN" \
59
+ https://taichu.example.com/api/content/article
60
+
61
+ # Agent access (API Key)
62
+ curl -H "X-Taichu-Agent-Key: $AGENT_KEY" \
63
+ https://taichu.example.com/api/content/article
64
+ ```
65
+
66
+ Agent-specific features:
67
+ - **Rate limiting per agent** — prevent runaway agents from overwhelming the system
68
+ - **Content pipelines** — agents can register as processors in content workflows
69
+ - **Audit trails** — every agent action is logged and attributable
70
+ - **MCP protocol** — agents discover Taichu's capabilities automatically via Model Context Protocol (Phase 2)
71
+
72
+ ### Zero Dependencies (Core)
73
+
74
+ The core runtime depends only on Node.js built-in modules. No npm install dance, no dependency hell. This is a deliberate choice:
75
+
76
+ - **Auditability** — every line of code can be reviewed
77
+ - **Longevity** — no risk of left-pad incidents
78
+ - **Performance** — no framework overhead
79
+ - **Simplicity** — `git clone && npm start` just works
80
+
81
+ *Optional dependencies (SQLite driver, vector store) will be clearly documented and isolated.*
82
+
83
+ ### Extensible by Design
84
+
85
+ Like WordPress's plugin system, but for agents:
86
+
87
+ ```js
88
+ // Register a content type
89
+ taichu.registerContentType(createContentType('product', {
90
+ label: 'Product',
91
+ fields: {
92
+ name: { type: 'string', required: true },
93
+ price: { type: 'number' },
94
+ description: { type: 'json' }
95
+ }
96
+ }));
97
+
98
+ // Hook into the content pipeline
99
+ taichu.hooks.on('afterCreate', async (doc, ctx) => {
100
+ if (doc.type === 'article') {
101
+ await autoGenerateExcerpt(doc);
102
+ await indexForSearch(doc);
103
+ }
104
+ });
105
+
106
+ // Agent capability extension
107
+ taichu.hooks.on('agent:onRequest', async (payload, ctx) => {
108
+ if (ctx.agent.scope === 'seo-optimizer') {
109
+ payload.enhancements = ['keywords', 'readability'];
110
+ }
111
+ });
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Quick Start
117
+
118
+ ```bash
119
+ # Clone
120
+ git clone https://github.com/Caludelaw/Taichu.git
121
+ cd taichu
122
+
123
+ # Run (yes, that's it — zero npm install needed for core)
124
+ npm start
125
+
126
+ # Taichu is now running at http://localhost:3120
127
+ # Health check: http://localhost:3120/api/health
128
+ ```
129
+
130
+ ### Create Your First Content
131
+
132
+ ```bash
133
+ # Create a document
134
+ curl -X POST http://localhost:3120/api/content/article \
135
+ -H "Content-Type: application/json" \
136
+ -d '{
137
+ "data": {
138
+ "title": "Hello Taichu",
139
+ "body": {"text": "Welcome to the agent-native CMS."},
140
+ "status": "published"
141
+ }
142
+ }'
143
+
144
+ # List all articles
145
+ curl http://localhost:3120/api/content/article
146
+
147
+ # Get a single article
148
+ curl http://localhost:3120/api/content/article/<id>
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Project Structure
154
+
155
+ ```
156
+ taichu/
157
+ ├── packages/
158
+ │ ├── core/ # Content model, storage abstraction, hook system
159
+ │ │ └── src/
160
+ │ │ ├── content-type.js # Schema definition & validation
161
+ │ │ ├── store.js # Storage interface + MemoryStore
162
+ │ │ ├── hooks.js # Lifecycle hook system
163
+ │ │ └── errors.js # Structured error types
164
+ │ ├── server/ # HTTP server (zero-dependency)
165
+ │ │ └── src/
166
+ │ │ ├── index.js # Server entry point
167
+ │ │ ├── router.js # URL routing
168
+ │ │ ├── context.js # Request context
169
+ │ │ └── routes/
170
+ │ │ └── api.js # REST API implementation
171
+ │ ├── mcp/ # MCP Server (Phase 2)
172
+ │ └── admin/ # Vue 3 Admin SPA (Phase 2)
173
+ ├── docs/
174
+ │ ├── architecture/ # Architecture Decision Records (ADRs)
175
+ │ ├── api/ # API documentation
176
+ │ └── guides/ # User & developer guides
177
+ ├── .github/
178
+ │ └── workflows/ # CI/CD pipelines
179
+ ├── LICENSE # MIT
180
+ ├── CONTRIBUTING.md # Contribution guide
181
+ └── CODE_OF_CONDUCT.md # Community standards
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Development Roadmap
187
+
188
+ | Phase | Focus | Status |
189
+ |-------|-------|--------|
190
+ | **Phase 1** | Core CMS: content model, REST API, memory store | 🚧 Alpha |
191
+ | **Phase 2** | AI-Native: vector search, MCP, agent permissions, GraphQL | 📋 Planned |
192
+ | **Phase 3** | Ecosystem: extension marketplace, multi-agent collaboration, federation | 📋 Planned |
193
+
194
+ See [ROADMAP.md](docs/ROADMAP.md) for details.
195
+
196
+ ---
197
+
198
+ ## Contributing
199
+
200
+ Taichu is in active early development. We welcome contributions from developers who share our vision of agent-native content infrastructure.
201
+
202
+ Read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines, and check [GitHub Issues](https://github.com/Caludelaw/Taichu/issues) for tasks tagged `good first issue`.
203
+
204
+ ---
205
+
206
+ ## License
207
+
208
+ MIT © 2026 Liu Huai'an and Taichu contributors. See [LICENSE](LICENSE).
@@ -0,0 +1,42 @@
1
+ # Taichu CMS — Docker Compose 一键部署
2
+ #
3
+ # 使用方法:
4
+ # 开发环境:docker compose up
5
+ # 生产环境:docker compose up -d
6
+ #
7
+ # 环境变量配置:
8
+ # TAICHU_PORT — 服务端口,默认 3120
9
+ # TAICHU_SECRET — JWT 签名密钥(生产环境必改)
10
+ # TAICHU_ADMIN_USER — 初始管理员用户名
11
+ # TAICHU_ADMIN_PASS — 初始管理员密码
12
+
13
+ services:
14
+ taichu:
15
+ build:
16
+ context: .
17
+ dockerfile: Dockerfile
18
+ container_name: taichu-cms
19
+ ports:
20
+ - "${TAICHU_PORT:-3120}:3120"
21
+ environment:
22
+ - NODE_ENV=production
23
+ - TAICHU_STORAGE=sqlite
24
+ - TAICHU_PORT=3120
25
+ - TAICHU_HOST=0.0.0.0
26
+ - TAICHU_PUBLIC_READ=1
27
+ - TAICHU_SECRET=${TAICHU_SECRET:-change-me-in-production}
28
+ - TAICHU_ADMIN_USER=${TAICHU_ADMIN_USER:-admin}
29
+ - TAICHU_ADMIN_PASS=${TAICHU_ADMIN_PASS:-admin123}
30
+ volumes:
31
+ - taichu-data:/app/.taichu
32
+ healthcheck:
33
+ test: ["CMD", "wget", "-qO-", "http://localhost:3120/api/health"]
34
+ interval: 30s
35
+ timeout: 5s
36
+ retries: 3
37
+ start_period: 10s
38
+ restart: unless-stopped
39
+
40
+ volumes:
41
+ taichu-data:
42
+ driver: local
@@ -0,0 +1,101 @@
1
+ # Taichu Development Roadmap
2
+
3
+ ## Phase 1: Core CMS ✅ COMPLETE
4
+
5
+ **Goal**: A working headless CMS with structured content, REST API, and hook-based extension system.
6
+
7
+ | Feature | Status | Package |
8
+ |---------|--------|---------|
9
+ | Content Type Schema Definition | ✅ Done | `@taichu/core` |
10
+ | Typed Field Validation | ✅ Done | `@taichu/core` |
11
+ | Memory Store (dev/testing) | ✅ Done | `@taichu/core` |
12
+ | Hook System (lifecycle hooks) | ✅ Done | `@taichu/core` |
13
+ | Structured Error Types | ✅ Done | `@taichu/core` |
14
+ | Zero-Dependency HTTP Server | ✅ Done | `@taichu/server` |
15
+ | REST API (CRUD + list) | ✅ Done | `@taichu/server` |
16
+ | CORS Middleware | ✅ Done | `@taichu/server` |
17
+ | JSON Body Parser | ✅ Done | `@taichu/server` |
18
+ | Architecture Decision Records | ✅ Done | `docs/` |
19
+ | SQLite Store (sql.js WASM) | ✅ Done | `@taichu/core` |
20
+ | Authentication (JWT + API Key) | ✅ Done | `@taichu/core` |
21
+ | Vue 3 Admin SPA | ✅ Done | `@taichu/admin` |
22
+ | Static File Serving | ✅ Done | `@taichu/server` |
23
+
24
+ ## Phase 2: AI-Native ✅ COMPLETE
25
+
26
+ **Goal**: AI agents become first-class content consumers and producers.
27
+
28
+ | Feature | Status |
29
+ |---------|--------|
30
+ | Agent API Key Authentication | ✅ Done |
31
+ | JWT Authentication (Human) | ✅ Done |
32
+ | MCP Server (stdio transport, 29 tools) | ✅ Done |
33
+ | TF-IDF Vector Search | ✅ Done |
34
+ | Content Auto-Indexing (hook-based) | ✅ Done |
35
+ | GraphQL API | ✅ Done |
36
+ | Content Pipeline Engine (3 built-in templates) | ✅ Done |
37
+ | Agent Permission Scopes | ✅ Done |
38
+ | Content Localization (ZHHK/EN/JP) | ✅ Done |
39
+ | SSO Framework (OIDC + LDAP) | ✅ Done |
40
+ | Webhook System | ✅ Done |
41
+ | Audit Logging (append-only) | ✅ Done |
42
+
43
+ ## Phase 3: Ecosystem ✅ COMPLETE
44
+
45
+ **Goal**: Developer ecosystem with extensions, themes, and real-time collaboration.
46
+
47
+ | Feature | Status |
48
+ |---------|--------|
49
+ | WebSocket Real-Time Updates | ✅ Done |
50
+ | Multi-Agent Collaboration Engine | ✅ Done |
51
+ | Plugin Manager (backend) | ✅ Done |
52
+ | Theme System (custom upload, __TAICHU__ injection) | ✅ Done |
53
+ | Admin SPA (18 pages, 3 locales) | ✅ Done |
54
+ | Content Revisions (field-level diff, max 100) | ✅ Done |
55
+ | Rate Limiting (token bucket, 3 dimensions) | ✅ Done |
56
+ | Notification Channels (Feishu/DingTalk/WeCom) | ✅ Done |
57
+ | CLI (init/dev/migrate) | ✅ Done |
58
+ | Docker Support | ✅ Done |
59
+ | CI/CD (GitHub Actions + Gitee mirror) | ✅ Done |
60
+ | ESLint Code Quality | ✅ Done |
61
+
62
+ ## v0.4.0 → v0.5.0 (Current)
63
+
64
+ | Feature | Priority | Status |
65
+ |---------|----------|--------|
66
+ | Server Integration Tests | P0 | ✅ Done |
67
+ | ROADMAP & Docs Update | P0 | ✅ Done |
68
+ | Brand Icon Redesign (Tai Chi ball) | P0 | ✅ Done |
69
+ | Scheduled Publishing | P1 | ✅ Done |
70
+ | Version Diff API | P1 | ✅ Done |
71
+ | Docker Compose One-Click Deploy | P1 | ✅ Done |
72
+ | Media Library Enhancement (compress/WebP/thumbs) | P1 | ✅ Done |
73
+ | Email Notification Channel | P2 | ✅ Done |
74
+ | Content Relationship Graph | P2 | ✅ Done |
75
+ | Multi-Tenant Support | P2 | ✅ Done |
76
+ | Plugin Marketplace (frontend + CLI install) | P2 | ✅ Done |
77
+ | ActivityPub Federation | P2 | ✅ Done |
78
+
79
+ ## v0.5.0 → v0.6.0 (Current)
80
+
81
+ | Feature | Priority | Status |
82
+ |---------|----------|--------|
83
+ | Dashboard Charts (content stats, trend graphs) | P1 | ✅ Done |
84
+ | Theme Frontend Pagination (blog list pages) | P1 | ✅ Done |
85
+ | Content Relationships Graph UI (admin visualization) | P1 | ✅ Done |
86
+ | Media Selector in Rich Editor | P1 | ✅ Done |
87
+ | Batch Operations (bulk delete/publish) | P2 | ✅ Done |
88
+ | Second Official Theme (minimal/portfolio) | P2 | ✅ Done |
89
+ | SSO OIDC Callback Handler | P2 | Todo |
90
+ | E2E Tests (Playwright, core flows) | P2 | Todo |
91
+ | API Reference Documentation | P2 | Todo |
92
+ | Custom Field Types (date, boolean, reference) | P3 | Todo |
93
+ | Content Export (JSON, Markdown, CSV) | P3 | Todo |
94
+ | Webhook Retry with Exponential Backoff | P3 | Todo |
95
+
96
+ ## Long-Term Vision
97
+
98
+ - **Taichu as content backbone for AI agent ecosystems** — every agent in a workflow uses Taichu as its shared content infrastructure
99
+ - **Federated content networks** — Taichu instances discover and share content via ActivityPub
100
+ - **Agent marketplace** — developers publish agent capabilities as installable extensions
101
+ - **Zero-config HA** — SQLite + Litestream for production-grade durability with single-binary simplicity
@@ -0,0 +1,102 @@
1
+ # Taichu API Documentation
2
+
3
+ ## Overview
4
+
5
+ Taichu is API-first. Everything you can do in the admin UI, you can do via the API.
6
+
7
+ - **Base URL**: `http://localhost:3120/api`
8
+ - **Content-Type**: `application/json`
9
+ - **Authentication**: JWT (humans) or API Key (agents) — coming in Phase 2
10
+
11
+ ## Endpoints
12
+
13
+ ### Health Check
14
+
15
+ ```
16
+ GET /api/health
17
+ ```
18
+
19
+ Response:
20
+ ```json
21
+ {
22
+ "status": "ok",
23
+ "name": "taichu",
24
+ "version": "0.1.0",
25
+ "uptime": 123.456
26
+ }
27
+ ```
28
+
29
+ ### Content Types
30
+
31
+ ```
32
+ GET /api/content-types
33
+ ```
34
+
35
+ Returns all registered content types.
36
+
37
+ ```
38
+ GET /api/content-types/:name
39
+ ```
40
+
41
+ Returns the JSON Schema for a specific content type.
42
+
43
+ ### Content CRUD
44
+
45
+ ```
46
+ GET /api/content/:type # List documents of type
47
+ POST /api/content/:type # Create a document
48
+ GET /api/content/:type/:id # Get a single document
49
+ PUT /api/content/:type/:id # Update a document
50
+ DELETE /api/content/:type/:id # Delete a document
51
+ ```
52
+
53
+ #### Query Parameters (for `GET /api/content/:type`)
54
+
55
+ | Parameter | Type | Description |
56
+ |-----------|------|-------------|
57
+ | `status` | string | Filter by status (`draft`, `published`, `archived`) |
58
+ | `search` | string | Full-text search across document data |
59
+ | `limit` | number | Max results (default: 50) |
60
+ | `offset` | number | Pagination offset |
61
+ | `orderBy` | string | Sort field (default: `updatedAt`) |
62
+ | `order` | string | Sort direction (`asc` or `desc`, default: `desc`) |
63
+
64
+ #### Examples
65
+
66
+ ```bash
67
+ # List all published articles
68
+ curl http://localhost:3120/api/content/article?status=published
69
+
70
+ # Create a new article
71
+ curl -X POST http://localhost:3120/api/content/article \
72
+ -H "Content-Type: application/json" \
73
+ -d '{"data":{"title":"Hello World","body":{"text":"First post!"}}}'
74
+
75
+ # Update an article
76
+ curl -X PUT http://localhost:3120/api/content/article/doc-123 \
77
+ -H "Content-Type: application/json" \
78
+ -d '{"data":{"title":"Updated Title"}}'
79
+
80
+ # Delete an article
81
+ curl -X DELETE http://localhost:3120/api/content/article/doc-123
82
+ ```
83
+
84
+ ## Error Responses
85
+
86
+ All errors follow this format:
87
+
88
+ ```json
89
+ {
90
+ "error": "ERROR_CODE",
91
+ "message": "Human-readable description",
92
+ "status": 400
93
+ }
94
+ ```
95
+
96
+ Error codes:
97
+ - `VALIDATION_ERROR` (400) — request body doesn't match content type schema
98
+ - `NOT_FOUND` (404) — resource doesn't exist
99
+ - `UNAUTHORIZED` (401) — missing or invalid credentials (Phase 2)
100
+ - `FORBIDDEN` (403) — insufficient permissions (Phase 2)
101
+ - `CONFLICT` (409) — resource conflict (e.g., duplicate slug)
102
+ - `INTERNAL_ERROR` (500) — unexpected server error
@@ -0,0 +1,61 @@
1
+ # ADR 001: Zero-Dependency Core Runtime
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-06-06
5
+ - **Author:** Liu Huai'an
6
+
7
+ ## Context
8
+
9
+ We need to choose the dependency strategy for Taichu's core runtime (`@taichu/core` and `@taichu/server`). The options range from full-framework (Express/Fastify + ORM + etc.) to zero-dependency (Node.js built-ins only).
10
+
11
+ ## Decision Drivers
12
+
13
+ 1. **Auditability** — open-source contributors must be able to understand every line of code
14
+ 2. **Longevity** — the project should remain viable for 10+ years without dependency churn
15
+ 3. **Performance** — minimal overhead for core operations
16
+ 4. **Install simplicity** — `git clone && npm start` should work immediately
17
+ 5. **Extensibility** — power users can swap in heavier dependencies when needed
18
+
19
+ ## Options Considered
20
+
21
+ ### Option A: Full Framework (Express + Prisma + etc.)
22
+
23
+ - **Pros**: Rapid development, familiar patterns, large ecosystem
24
+ - **Cons**: Heavy dependency tree, breaking changes risk, "magic" behavior
25
+
26
+ ### Option B: Minimal Dependencies (Fastify or Hono)
27
+
28
+ - **Pros**: Lighter than Express, modern APIs, maintained
29
+ - **Cons**: Still external dependencies, version drift risk
30
+
31
+ ### Option C: Zero Dependencies (Node.js built-ins only)
32
+
33
+ - **Pros**: Maximum auditability, zero supply-chain risk, instant startup, eternal viability
34
+ - **Cons**: More code to write, less "batteries included"
35
+
36
+ ## Decision
37
+
38
+ **We choose Option C: Zero Dependencies for the core runtime.**
39
+
40
+ The core packages (`@taichu/core`, `@taichu/server`) use only Node.js built-in modules. Optional dependencies (SQLite driver, vector store) are isolated in separate packages.
41
+
42
+ ## Consequences
43
+
44
+ ### Positive
45
+
46
+ - `git clone && npm start` works with zero `npm install` for core
47
+ - Every line of code is auditable by any Node.js developer
48
+ - No left-pad incidents, no dependency confusion attacks
49
+ - Cold start time is measured in milliseconds, not seconds
50
+
51
+ ### Negative
52
+
53
+ - We write our own HTTP router, body parser, and middleware stack
54
+ - Fewer "batteries included" — developers migrating from Express need to learn our API
55
+ - Some features (file upload parsing, WebSocket) require more effort
56
+
57
+ ### Mitigations
58
+
59
+ - Clear JSDoc documentation for all public APIs
60
+ - The API design is intentionally similar to familiar patterns (middleware stack, context object)
61
+ - Complex features that truly need external deps are in separate packages (e.g., `@taichu/driver-sqlite`)
@@ -0,0 +1,70 @@
1
+ # ADR 002: Structured Content Model with JSON-LD
2
+
3
+ - **Status:** Accepted
4
+ - **Date:** 2026-06-06
5
+ - **Author:** Liu Huai'an
6
+
7
+ ## Context
8
+
9
+ Traditional CMS (WordPress, Typecho) store content as HTML strings in a `post_content` column. Headless CMS (Strapi, Directus) store structured JSON but without semantic markup. For an agent-native CMS, we need content to be both structured and semantically meaningful.
10
+
11
+ ## Decision Drivers
12
+
13
+ 1. **Machine readability** — AI agents must be able to parse and understand content without HTML scraping
14
+ 2. **Semantic interoperability** — content should map to standard vocabularies (schema.org, JSON-LD)
15
+ 3. **Multi-format output** — same content should render as HTML, RSS, JSON-LD, or agent response
16
+ 4. **Validation** — content type schemas should be enforceable at the API level
17
+
18
+ ## Options Considered
19
+
20
+ ### Option A: HTML String Storage (WordPress model)
21
+
22
+ Rejected: AI agents must parse HTML to extract meaning. Loses structured data. Not forward-compatible.
23
+
24
+ ### Option B: Generic JSON (Strapi model)
25
+
26
+ Rejected: Structured but not semantic. No standard way to map fields to schema.org types. Agents must guess what each field means.
27
+
28
+ ### Option C: JSON-LD with Content Type Schemas (our approach)
29
+
30
+ Accepted: Each content type registers a schema (typed fields + validation rules + optional schema.org mapping). Documents are stored as structured JSON. The API can output JSON-LD for search engines and structured JSON for agents.
31
+
32
+ ## Decision
33
+
34
+ **Taichu uses typed content type schemas with optional JSON-LD semantic markup.**
35
+
36
+ Each content type:
37
+ 1. Defines typed fields (`string`, `number`, `json`, `array`, `enum`, `datetime`, `media`, `relation`)
38
+ 2. Has validation rules (required, maxLength, pattern, enum values)
39
+ 3. Can map to a schema.org type (e.g., `schemaOrg: 'Article'`)
40
+ 4. Fields can have semantic property mappings (e.g., `semantic: 'headline'`)
41
+
42
+ ## Content Type Example
43
+
44
+ ```js
45
+ const Article = createContentType('article', {
46
+ label: 'Article',
47
+ schemaOrg: 'Article',
48
+ fields: {
49
+ title: { type: 'string', required: true, semantic: 'headline' },
50
+ body: { type: 'json', required: true, semantic: 'articleBody' },
51
+ excerpt: { type: 'string', maxLength: 500, semantic: 'description' },
52
+ author: { type: 'relation', target: 'author', semantic: 'author' },
53
+ tags: { type: 'array', items: { type: 'string' }, semantic: 'keywords' },
54
+ publishedAt: { type: 'datetime', semantic: 'datePublished' }
55
+ }
56
+ });
57
+ ```
58
+
59
+ ## Consequences
60
+
61
+ ### Positive
62
+ - Content is machine-readable by default
63
+ - Schema validation at the API layer catches errors early
64
+ - JSON-LD output is SEO-friendly and search-engine compatible
65
+ - Agents can introspect content types to understand available fields
66
+
67
+ ### Negative
68
+ - More upfront design work to define content types
69
+ - Migration from HTML-based CMS requires content extraction
70
+ - Not all content naturally fits a typed schema (handled by `json` type for free-form fields)